Class Vehicle

java.lang.Object
  extended by Vehicle

public class Vehicle
extends java.lang.Object

Vehicle class is a structure of basic attributes for any vehicle. This class uses Color class to implement any possible vehicle colour.

Since:
29.03.09
Version:
2.0
Author:
Dolev&Morad
See Also:
Color

Constructor Summary
Vehicle(int licensePlate, int year, java.lang.String manufacturer, java.lang.String model, java.awt.Color colour, int numDoors)
          This method is a constructor for vehicle class.
 
Method Summary
 java.lang.String getColour()
          This method checks if colour is not null.
 int getLicensePlate()
          This method
 java.lang.String getManufacturer()
          This method
 java.lang.String getModel()
          This method
 int getNumDoors()
          This method
 int getYear()
          This method
 void setColour(java.awt.Color colour)
          The method updates the colour of the vehicle, after the input colour is checked and it is one of the legal colours.
 java.lang.String toString()
          The method @return a string representation of a Vehicle.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Vehicle

public Vehicle(int licensePlate,
               int year,
               java.lang.String manufacturer,
               java.lang.String model,
               java.awt.Color colour,
               int numDoors)
This method is a constructor for vehicle class.

Parameters:
year -
manufacturer -
model -
colour -
numDoors -
Method Detail

getYear

public int getYear()
This method

Returns:
the year attribute.

getColour

public java.lang.String getColour()
This method checks if colour is not null.

Returns:
the colour attribute as a String. If null the Unknown colour String returned.

setColour

public void setColour(java.awt.Color colour)
The method updates the colour of the vehicle, after the input colour is checked and it is one of the legal colours. The vehicle can be coloured in only 4 colours, BLACK, BLUE, GREEN or WHITE . Any other colour is illegal and set as null.

Parameters:
colour -

getModel

public java.lang.String getModel()
This method

Returns:
the model attribute.

getManufacturer

public java.lang.String getManufacturer()
This method

Returns:
the manufacturer attribute.

getNumDoors

public int getNumDoors()
This method

Returns:
the number of doors attribute.

getLicensePlate

public int getLicensePlate()
This method

Returns:
the license plate attribute.

toString

public java.lang.String toString()
The method @return a string representation of a Vehicle.

Overrides:
toString in class java.lang.Object